function initLineTable(id,url) {
    $('#'+id).bootstrapTable('destroy');
    $("#"+id).bootstrapTable({
        method: "post",  //使用get请求到服务器获取数据
        url:  ctx + url, //获取数据的Servlet地址
        cache: false,
        //striped: true,  //表格显示条纹
        pagination: true, //启动分页
        contentType : "application/x-www-form-urlencoded; charset=UTF-8",
        pageSize: 10,  //每页显示的记录数
        pageNumber: 1, //当前第几页
        search: false,  //是否启用查询
        sidePagination: "server", //表示服务端请求
        //设置为undefined可以获取pageNumber，pageSize，searchText，sortName，sortOrder
        //设置为limit可以获取limit, offset, search, sort, order
        queryParamsType: "undefined",
        queryParams: function queryParams(params) {   //设置查询参数
            var param = {
                iDisplayStart: (params.pageNumber-1) * params.pageSize,
                iDisplayLength: params.pageSize,
                instrumentId:'62'
            };
        },
        responseHandler: function (res) {//这里我查看源码的，在ajax请求成功后，发放数据之前可以对返回的数据进行处理，返回什么部分的数据，比如我的就需要进行整改的！
            return {
                "total": res.data.total,//总页数
                "rows": res.data.list  //数据
            };
        },
        onLoadSuccess: function (res) {  //加载成功时执行
//            	alert("加载成功");
            console.log(res)
        },
        onLoadError: function () {  //加载失败时执行
            alert("加载数据失败");
        }
    });
}
$(document).ready(function() {
    var Vm = new Vue({
        el: ".wrap",
        data: {
            name:'',
            SN:'',
            type:'',
            brand:'',
            status:'',
            hospital:'',
            pic:'',
            items:[],
            rentMan:'',
            rentTel:'',
            rentTime:'',
            rentMoney:'',
            backTime:'',
            rentStatus:''
        },
        methods: {
            getInfo(id){
                let that = this;
                $.ajax({
                    url: ctx + '/instrument/info',
                    data:{
                      id:id
                    },
                    type: 'post',
                    async: false, //默认为true 异步
                    dataType: 'json',
                    success: function (res) {
                        console.log(res)
                        if (res.data == null) {
                            return
                        } else {
                            that.name = res.data.instrument.instrumentType;
                            that.SN = res.data.instrument.instrumentSN;
                            that.type = res.data.instrument.instrmentVersion;
                            that.brand = res.data.instrument.instrumentBrand;
                            console.log()
                            that.status = res.data.instrument.instrumentStatus;
                            that.hospital = res.data.instrument.hospitalName;
                            // that.pic = 'data:image/png;base64,' + res.data.photo;
                            that.items =  that.items.concat(res.data.ies);
                            // 当前租赁情况
                            if(res.data.rent == null){
                               return;
                            }else{
                                that.rentMan = res.data.rent.rentMan;
                                that.rentTel = res.data.rent.rentTel;
                                that.rentTime = res.data.rent.rentTime;
                                that.rentMoney = res.data.rent.rentMoney;
                                that.backTime = res.data.rent.backTime;
                                that.rentStatus = res.data.rent.rentStatus;
                            }
                        }
                    }
                })
            },
            deleteBind(id){
                let _this = this;
                $.ajax({
                    url: ctx + '/instrument/deletedInstrumentWechat',
                    data: {
                        id: id
                    },
                    type: 'post',
                    async: true, //默认为true 异步
                    dataType: 'json',
                    error: function (data) {
                        alert('error');
                    },
                    success: function (res) {
                        if(res.success){
                            var tempJSON = _this.items;
                            var newArr = new Array();
                            for(var i=0;i< tempJSON.length;i++){
                                var j=tempJSON[i];
                                if(j.id != id){
                                    newArr.push(j);
                                }
                            }
                            _this.items = newArr;
                        }
                    }
                });
            },
            getPic(sn){
                let _this = this;
                $.ajax({
                    url: ctx + '/instrument/qrcode',
                    data: {
                        sn:sn
                    },
                    type: 'post',
                    async: false, //默认为true 异步
                    dataType: 'json',
                    error: function (data) {
                        alert('error');
                    },
                    success: function (res) {
                        if(res.success){
                            _this.pic = res.data;
                        }
                    }
                });
            }
        },
        created(){
            var urlParam = decodeURI(window.location.href.split("?")[1]);
            this.departmentId = urlParam.split("departmentId=")[1].split("&")[0];
            console.log(this.departmentId)
            this.getInfo( this.departmentId);
            this.getPic(this.SN);
        }
    });
});
